package com.oop.demo01;

public class Person {

    //一个类什么都不写，他也会存在一个默认构造器
    //显式定义构造器

    String name;
    int age;
    //无参构造
    public Person(){
        this.name = "lishizheng";
    }

    //有参构造
    //一旦定义了有参构造，无参构造就必须得显式定义。
    public Person(String  name){
        this.name = name;
    }
    //alt + insert 快速生成构造器


    public Person(int age) {
        this.age = age;
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

/*
*  public static void main(String[] args) {
        Person person = new Person("azheng");
        Person person1 = new Person(10);
        System.out.println(person.name);
        System.out.println(person1.name + " " +person.age);
    }

*
* */
